\documentclass[12pt,twoside,a4paper]{report/tesis}
\usepackage{report/a4}
\usepackage{latexsym}
\usepackage[catalan,spanish,english]{babel}
\usepackage[catalan]{babelbib}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{makeidx}
\usepackage{amsmath}
\usepackage{graphicx}

% Glossary
\usepackage{glossary}
\makeglossary

\input{report/config}
\input{report/commands}

% ifpdf package
\RequirePackage{ifpdf}

% hyperrefs
\RequirePackage{url}
\ifpdf
  \RequirePackage[pdftex,pdfpagelayout=TwoColumnRight]{hyperref}
\else
  \RequirePackage[dvips,pdfpagelayout=TwoColumnRight]{hyperref}\fi
\AtBeginDocument{%
    \hypersetup{%
      breaklinks,
      baseurl       = http://,
      pdfborder     = 0 0 0,
      pdfpagemode   = None,
      pdfpagelayout = TwoColumnRight,
      pdfstartview  = XYZ,
      pdfstartpage  = 1,
      pdfauthor     = \authordoc,%
      pdftitle      = \titledoc,%
      pdfsubject    = \titledockind,%
      pdfkeywords   = \titledockind~\titledoc~\titledocCA,
      pdfcreator    = \LaTeX{},%
      pdfproducer   = \LaTeX}}
\urlstyle{tt}

\selectlanguage{catalan}
\setlength{\headheight}{15pt}

\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
\makeindex

\begin{document}

\vspace{2cm}

\begin{center}
\thispagestyle{empty}



\

\

\

\

%\hspace{-5cm} % para dvi
%\hspace{-3cm} % para ps

\


{\Large {\sc \universitat}}\\
\vspace{3mm}
{\normalsize {\escola}} \\
\

\


{\Large {\sc \titledockind}}\\


\

\


{\Large {\bf \titledoc}}\\ 
\vspace{2mm}
{\Large {\bf \ }} \\
\vspace{1mm}
{\Large {\bf }}

\

\

\

\end{center}

\begin{flushright}
{\normalsize Autor: \bf \authordoc\hspace{1cm}}\\
\vspace{1mm}
{\normalsize {Director: \bf \directordoc}}\\
\vspace{1mm}
{\normalsize {\escola}}\\
\vspace{1mm}
{\normalsize {\titulacio}}\\
\vspace{1cm}
{\normalsize {\today}}\\
\end{flushright}

\break
\clearemptydoublepage

\chapter*{Introducció}
\thispagestyle{empty}
\input{chapters/intro}
\clearemptydoublepage

\pagenumbering{roman}
\tableofcontents \clearemptydoublepage
\listoffigures   \clearemptydoublepage 
\listoftables    \clearemptydoublepage 
\printglossary   \clearemptydoublepage 

\pagestyle{fancyplain}
\fancyhf{}

\fancypagestyle{plain}{ %
\fancyhf{} % remove everything
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}}

\fancyfoot[LE,RO]{\thepage}
\fancyhead[RO]{\textit{\nouppercase{\leftmark}}}
\fancyhead[ER]{\textit{\titledockind}}
 
\fancypagestyle{plain}{ %
\fancyhf{} % remove everything
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}}


\pagenumbering{arabic}
\setcounter{page}{1}

\input{report/chapters}

\clearemptydoublepage

%%%  BIBLIOGRAFIA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% BibTeX
\phantomsection
\addcontentsline{toc}{chapter}{Bibliografia}
\nocite{*}
\selectbiblanguage{catalan}
\setbtxfallbacklanguage{catalan}
%%% a)  Estil de bibliografia
\bibliographystyle{babunsrt-fl}
%%% b) Indicar els fitxers que contenen la bibliografia
\bibliography{report/bibliography,report/rfc}
\clearemptydoublepage
\end{document}
